//
//  GBRequest.h
//  和讯股票
//
//  Created by guobin on 14-9-27.
//  Copyright (c) 2014年 guobin. All rights reserved.
//

#import <Foundation/Foundation.h>

//声明定义的协议
@protocol GBRequestDelegate;

@interface GBRequest : NSObject

//用户请求得到的数据
@property(strong,nonatomic) NSData* requestData;
//用户请求得到的字符串
@property(strong,nonatomic) NSString* requestStr;
//多次请求下的区分 tag
@property(assign,nonatomic) NSInteger tag;
@property (nonatomic, strong) NSURL *url;
//代理对象
@property(weak,nonatomic) id<GBRequestDelegate> delegate;

//获取request实例的方法
- (instancetype)initWithUrlStr:(NSString *)urlStr;
// 开始异步请求数据
- (void)startRequestData;

@end

//定义代理协议 用户回调方法
@protocol GBRequestDelegate <NSObject>
//数据成功请求完毕
- (void)requestDidFinished:(GBRequest *)request;
//数据请求失败
- (void)requestDidFailedWithError:(NSError *)error;

@end
